define([
  'utils/Conf',
  'models/Model'
], function(Conf, Model){
  var Residence = Model.extend({
    url: function() {
      var urlBase = Conf.routes.residences.detail;
      console.log("Residence id: " + this.id);
      if(this.id) {
        urlBase += "/" + this.id;
      }
      return urlBase;
    },

    // INFO When the residence is saved, the location uri from the response header is not ok, so it is replaced here.
    save: function(attrs, options) {
      options || (options = {});
      var url = this.url;
      options.success = function(model, resp) {
        model.url = url;
      };
      Model.prototype.save.call(this, attrs, options);
    }
    

  });

  return Residence;
});